# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=lxc-templates-legacy
pkgver=3.0.3
pkgrel=3
pkgdesc="Legacy LXC container templates"
url="https://linuxcontainers.org"
arch="noarch"
license="LGPL-2.1"
depends="bash tar"
subpackages="$pkgname-alpine"
source="https://linuxcontainers.org/downloads/lxc/lxc-templates-$pkgver.tar.gz
	add-mips64-s390x.patch
	alpine-skip-mknod-when-existing.patch
	add-riscv64-key.patch
	"
builddir="$srcdir/lxc-templates-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

alpine() {
	pkgdesc="$pkgdesc (for Alpine)"
	depends=
	mkdir -p "$subpkgdir"/usr/share/lxc/templates \
		"$subpkgdir"/usr/share/lxc/config
	local i; for i in templates/lxc-alpine config/alpine.userns.conf \
		config/alpine.common.conf; do
		mv $pkgdir/usr/share/lxc/$i "$subpkgdir"/usr/share/lxc/${i%/*}/
	done
}

sha512sums="
3e9d5304f5e06580eeb766570ddfebb0c80061c2d7e47c9ea37d834fe0cf4fabe7eedd667e4937df3f2451bc3e7aa1e98a1b386f3b19964dc218ff0e21011632  lxc-templates-3.0.3.tar.gz
9e4a28374e5c52315deed1f643ddbcfcca8f7fc96745f456f567721287c8b87b4d974ca901c3f018ea58bcaca07896d3b1bc465749812ef1ee80d936a12031ad  add-mips64-s390x.patch
10218eb23e70af82c3e059e462b3decd7af47bf7bc26324ed30848d18e33a317489cc2b92bb91f3a82c5fac6b3d3649cec452df80f2cca2bd2ce0e8eb2b4fd0f  alpine-skip-mknod-when-existing.patch
50a7a6d256071907694ec955aa4b92e8577a75443d1e6b3321aa7f8caf279416afba866924526033d72e3ebbece56badbba16572c02749a676abe5b6d8583476  add-riscv64-key.patch
"
